<html>
  <head>
    <meta charset="UTF-8" />
  </head>
  <body>
    <p>Log time of isURLExpired();</p>

    <script>
      // Fakery to make it load in the window
      self.registration = {
        scope: 'inject-scope',
      };
    </script>

    <script src="../../../../packages/workbox-core/build/browser/workbox-core.dev.js"></script>
    <script src="../../../../packages/workbox-expiration/build/browser/workbox-expiration.dev.js"></script>
    <script>
      const CacheExpiration = workbox.expiration.CacheExpiration;

      const expirationManager = new CacheExpiration('cache-name', {
        maxAgeSeconds: 2,
      });
      expirationManager.updateTimestamp('/', Date.now());

      const test = async () => {
        const t0 = performance.now();
        const expired = await expirationManager.isURLExpired('/');
        const t1 = performance.now();
        console.log(
          `Call to doSomething took "${t1 - t0}" milliseconds.`,
          expired,
        );
      };

      test();

      setTimeout(test, 2000);
    </script>
  </body>
</html>
